package cn.com.joco.dk.webby.generate;

import java.io.IOException;

import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;

public class FtpConnectionManager {
	private String host="127.0.0.1";
	private String port="80";
	private String username="publish";
	private String password="publish2";
	private String basedir="/";

	public void testConnection() throws Exception, IOException{
		FTPClient ftpClient=new FTPClient();
		ftpClient.connect("127.0.0.1", 1009);
		ftpClient.login("publish", "publish");
		int reply = ftpClient.getReplyCode();  
		if(FTPReply.isPositiveCompletion(reply)){
			System.out.println("链接成功");
		}else{
			System.out.println("链接失败");
		}
		boolean status=ftpClient.changeWorkingDirectory("/work");
		if(!status){
			ftpClient.changeWorkingDirectory("/");
			ftpClient.makeDirectory("/work");
		}
		System.out.println("G:\\tmp~1\\localhost\\".replace("\\", "/").split("/"));
	}
	
	
	public String getHost() {
		return host;
	}
	public String getPort() {
		return port;
	}
	public String getUsername() {
		return username;
	}
	public String getPassword() {
		return password;
	}
	public String getBasedir() {
		return basedir;
	}
	public void setHost(String host) {
		this.host = host;
	}
	public void setPort(String port) {
		this.port = port;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setBasedir(String basedir) {
		this.basedir = basedir;
	}
	
	
}
